package service;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import bsh.*;

public class DummyAnnotator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		// BASHCODE
		
		//Pattern p = Pattern.compile("\\d+[*|+|-|/]\\d+=[?]");
		
		Pattern p = Pattern.compile("eval\\((.+)\\)\\?");
		
		Pattern p1 = Pattern.compile("\\s[*]=?");

		Matcher m = p.matcher("i am summing eval(123)?  1352*453=?");
		
		if(m.find())
		{
			String anti = m.group();
			System.out.println(anti);
			System.out.println(m.groupCount());
			System.out.println(m.group(0));
			System.out.println(m.group(1));
		}
		else
			System.out.println("NOT FOUND");
		
		Interpreter bsh = new Interpreter();
		
		
		try {
			bsh.eval("ans = (100 * (90+10)/10)");
			System.out.println(bsh.get("ans"));
		} catch (EvalError e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		//check regex
		//(?:[Bb]ug|[Ii]ssue|[Tt]icket|[Cc]ase) #?(\\d+)
		
		/*Pattern p = Pattern.compile("\\d+[*|+|-|/]\\d+=[?]");

		Matcher m = p.matcher("i am summing  1352*453=?");
		
		if(m.find())
		{
			String anti = m.group();
			System.out.println(anti);
		}
		else
			System.out.println("NOT FOUND");*/
		
		
		/*if(m.find())
		{
			System.out.println(m.group());
			String expr = m.group();
			String expr1 = new String(expr);
			Pattern pat = Pattern.compile("[*|+|-|/]");
			Matcher mat = pat.matcher(expr);
			if(mat.find())
				System.out.println(mat.group());
			else
				System.out.println("NO MATCH");
			//expr1.replaceFirst(mat, replacement)
		}
		else
		{
			System.out.println("NOFOUND");
		}*/
	}
}
